package com.sunshine.wrongquestionset.activity.main

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.fragment.app.FragmentManager
import androidx.viewpager2.adapter.FragmentStateAdapter

/**
 * @author sunshine
 * @date 2021/3/28
 */
class FragmentAdapter(fragmentActivity: FragmentActivity): FragmentStateAdapter(fragmentActivity) {

    private var fragmentList: ArrayList<Fragment> = ArrayList()

    init {
        fragmentList.add(0, HomeFragment())
        fragmentList.add(1, SearchFragment())
        fragmentList.add(2, AnalyzerFragment())
        fragmentList.add(3, MeFragment())
    }

    override fun getItemCount(): Int {
        return fragmentList.size
    }

    override fun createFragment(position: Int): Fragment {
        return fragmentList[position]
    }
}